Optional Layers.f

Requires Quotations
Requires Structs
Requires SORA\Rendering
Requires SORA\Motifs

Only Forth Definitions

/Rendernode Inherit
   cell field ->slotpool
End-struct /Layer

:[] each:[ ( layer xt -- ) ( [blk] -- )
   >q
   ->slotpool @ slotpool-count 0 do @+ ?dup if >[ q@ execute ]. then loop drop q> drop  ;

: Layer:  ( capacity -- )
   Create /Layer /allot
   here 0 third material, lastbody ->material !
   here swap slotpool, lastbody ->slotpool !
   lastbody init-rendernode
   here transform, lastbody ->transform ! ;

: add-to  ( [blk] layer -- )
   ->slotpool @ slotpool ! +motif ;

: remove  ( [blk] -- )
   -motif slotpool off ;

